#!/usr/bin/make -f

package=skytraq-datalogger

build:
	$(checkdir)
	$(MAKE) 
	touch build

clean:
	$(checkdir)
	rm -f build
	$(MAKE) clean
	rm -rf debian/tmp debian/files* core debian/substvars

binary-indep: checkroot build
	$(checkdir)

binary-arch: checkroot build
	$(checkdir)
	rm -rf debian/tmp
	install -d debian/tmp/DEBIAN
	cd debian/tmp && install -d `cat ../dirs`
	$(MAKE) install DESTDIR=`pwd`/debian/tmp/
	dpkg-gencontrol 
	chown -R root.root debian/tmp
	chmod -R go=rX debian/tmp
	dpkg --build debian/tmp ..

define checkdir
	test -f debian/rules
endef

binary: binary-indep binary-arch

checkroot:
	$(checkdir)
	test root = "`whoami`"

.PHONY: binary binary-arch binary-indep clean checkroot

